package com.dycx.api.controller.manage.message;

import com.dycx.common.RestResponse;
import com.dycx.message.dto.WxMessageDTO;
import com.dycx.message.service.MessageService;
import com.dycx.message.vendor.dto.MessageContentDTO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping(value = "/manage/message/message")
public class MessageController {

    @Resource
    private MessageService messageService;

    /**
     * 分页
     **/
    @PostMapping("/sendWxTemplateMessage")
    public RestResponse<?> sendWxTemplateMessage(@RequestBody WxMessageDTO wxMessageDTO) {
        MessageContentDTO messageContentDTO = new MessageContentDTO();
        messageContentDTO.setWx(wxMessageDTO.getMessageValue());

        return messageService.sendWxTemplateMessage(wxMessageDTO.getTemplateId(), messageContentDTO) ? RestResponse.success() : RestResponse.fail();
    }


}
